# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataMigration.V1.Model.EntityMapping do
  @moduledoc """
  Details of the mappings of a database entity.

  ## Attributes

  *   `draftEntity` (*type:* `String.t`, *default:* `nil`) - Target entity full name. The draft entity can also include a column, index or constraint using the same naming notation schema.table.column.
  *   `draftType` (*type:* `String.t`, *default:* `nil`) - Type of draft entity.
  *   `mappingLog` (*type:* `list(GoogleApi.DataMigration.V1.Model.EntityMappingLogEntry.t)`, *default:* `nil`) - Entity mapping log entries. Multiple rules can be effective and contribute changes to a converted entity, such as a rule can handle the entity name, another rule can handle an entity type. In addition, rules which did not change the entity are also logged along with the reason preventing them to do so.
  *   `sourceEntity` (*type:* `String.t`, *default:* `nil`) - Source entity full name. The source entity can also be a column, index or constraint using the same naming notation schema.table.column.
  *   `sourceType` (*type:* `String.t`, *default:* `nil`) - Type of source entity.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :draftEntity => String.t() | nil,
          :draftType => String.t() | nil,
          :mappingLog => list(GoogleApi.DataMigration.V1.Model.EntityMappingLogEntry.t()) | nil,
          :sourceEntity => String.t() | nil,
          :sourceType => String.t() | nil
        }

  field(:draftEntity)
  field(:draftType)
  field(:mappingLog, as: GoogleApi.DataMigration.V1.Model.EntityMappingLogEntry, type: :list)
  field(:sourceEntity)
  field(:sourceType)
end

defimpl Poison.Decoder, for: GoogleApi.DataMigration.V1.Model.EntityMapping do
  def decode(value, options) do
    GoogleApi.DataMigration.V1.Model.EntityMapping.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DataMigration.V1.Model.EntityMapping do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
